package com.dbz.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dbz.dao.UserDao;
import com.dbz.entity.User;
import com.dbz.entity.UserRoles;
import org.apache.ibatis.annotations.Param;


import java.util.List;

public interface UserService extends IService<User>{
    public List<User> selectUser();

    /**
     * 根据名称查询用户信息
     * @param userName
     * @return
     */
    public User getUserByName(String userName);

    /**
     * 根据用户名密码查询id
     * @param userName
     * @param password
     * @return
     */
    public String getById(@Param("userName")String userName , @Param("password")String password);

    /**
     * 根据id修改用户
     * @param user
     * @return
     */
    public int updateRoleById(User user);

    /**
     * 根据id删除用户
     * @param uid
     * @return
     */
    public int deleteUserById(String uid);

    /**
     * 添加用户信息
     * @param user
     * @return
     */
    public int userAdd(User user);

    /**
     * 查询所有
     * @return
     */
    public List<User>getAll();

    /**
     * 分页查询
     * @param page
     * @param queryMapper
     * @return
     */
    public IPage<User>selectPage(IPage<User> page, @Param(Constants.WRAPPER) Wrapper<User> queryMapper);

    /**
     * 根据id查询用户
     * @param uid
     * @return
     */
    public User selectUserById(String uid);

    /**
     * 移除用户角色
     * @param uid
     * @param rid
     * @return
     */
    public int delUserRolesByUidAndRid(@Param("uid") String uid,@Param("rid") String rid);
}
